#include<stdio.h>
#include<stdlib.h>

int enQueue(int *a, int rear, int data) {
	a[rear] = data;
	rear++;
	return rear;
}

void deQueue(int *a, int front, int rear) {
	//若rear == front，则队列空了
	while (front != rear) {
		printf("出队的元素是：%d\n", a[front]);
		front++;
	}
}

int main() {
	int a[100];
	memset(&a, 0, 100);
	int front, rear;
	//设置队头指针和队尾指针，若队列中没有元素时，头和尾都是一样的
	front = rear = 0;
	//入队
	//入队
	rear = enQueue(a, rear, 1);
	rear = enQueue(a, rear, 2);
	rear = enQueue(a, rear, 3);
	rear = enQueue(a, rear, 4);
	//出队
	deQueue(a, front, rear);
	return 0;
}
